1 00:00:00,660 --> 00:00:01,210 Hello. 2 00:00:01,230 --> 00:00:10,940 In this lecture are we going to create the functionality for our projet using javascript to save time. 3 00:00:10,950 --> 00:00:17,520 I have already had the javascript to our javascript file are just wrong. 4 00:00:17,520 --> 00:00:20,600 True they could with you on line one. 5 00:00:20,610 --> 00:00:28,400 I've created a variable chord name and I've set it to each quarter to prompt the prompt. 6 00:00:28,410 --> 00:00:37,780 Is he have a script method that displays a prompt box where it prompt you to enter something. 7 00:00:37,960 --> 00:00:47,700 So in that prompt I have specified what I want the prompt to do so you should say enter your name please 8 00:00:47,730 --> 00:00:52,210 and then inside the prompt you have the variable name. 9 00:00:52,230 --> 00:00:55,260 So this here is where you change. 10 00:00:55,500 --> 00:01:02,490 So when you click on the page it should have this name so you need to change that and insert your name. 11 00:01:02,820 --> 00:01:09,120 If not he extended greeting to this value code name. 12 00:01:09,300 --> 00:01:17,460 So line 1 is just to claim the variable name and set in it took a course to prompt. 13 00:01:17,490 --> 00:01:22,720 So Line 1 will enable the prompt which is a method. 14 00:01:22,830 --> 00:01:26,630 It will display the dialogue box with this message. 15 00:01:26,670 --> 00:01:36,200 Inside is parentheses line to create a variable called today and I've set it to equal to date object. 16 00:01:36,200 --> 00:01:42,360 So if you want to create a you can use the new Date object we we've created a object here using the 17 00:01:42,360 --> 00:01:55,140 new date date object lets you work with dates which includes years month days hours minutes seconds 18 00:01:55,230 --> 00:01:59,990 and merely seconds on line 3. 19 00:02:00,000 --> 00:02:10,850 I have created a variable called powers and I've set it to a few to to day don't get ours the get powers 20 00:02:10,950 --> 00:02:21,790 method is used to return the hour up cording to the local time on your computer. 21 00:02:22,070 --> 00:02:28,350 So day to day here today is referencing the variable today so it is variable. 22 00:02:28,350 --> 00:02:37,560 Hours equals four days variable Don't forget ours method which will return the powers up calling to 23 00:02:37,740 --> 00:02:40,600 the local time on your computer. 24 00:02:40,830 --> 00:02:51,010 So once variable here gets the hours from the computer line for here to display that on the screen is 25 00:02:51,030 --> 00:02:52,420 in the document. 26 00:02:52,430 --> 00:02:58,070 Don't write in write line document. 27 00:02:58,080 --> 00:03:00,520 Don't write a line here. 28 00:03:00,640 --> 00:03:08,430 Okay so what it does it will display the time it will display this and then in break look past the break. 29 00:03:08,430 --> 00:03:09,510 This is a break tag. 30 00:03:09,530 --> 00:03:15,560 You create a space and then on the other line it will create this right. 31 00:03:15,620 --> 00:03:18,260 This statement then creates a break. 32 00:03:18,300 --> 00:03:20,540 Okay so this is what this function will do. 33 00:03:20,550 --> 00:03:30,010 Each tool used this document the right line basically is it'll create a line after each statement. 34 00:03:30,030 --> 00:03:32,670 That's what that is okay. 35 00:03:33,280 --> 00:03:41,580 Document derived line is a javascript method that is similar to the document or to write. 36 00:03:41,610 --> 00:03:49,350 The only difference is that heat adds a new line character after the statement right in the document 37 00:03:49,500 --> 00:03:50,020 right. 38 00:03:50,020 --> 00:03:53,060 Method is mostly use. 39 00:03:53,170 --> 00:04:03,240 Notice here my 7 document or write method that is mostly used for testing purposes you must never use 40 00:04:03,240 --> 00:04:11,380 it in a production environment because if it is used half his thier email isn't fully loaded it would 41 00:04:11,380 --> 00:04:14,590 delete all the existing hastier mail. 42 00:04:14,700 --> 00:04:17,610 So never use it in the production environment. 43 00:04:17,610 --> 00:04:20,610 This is only for testing purposes. 44 00:04:20,790 --> 00:04:22,650 Okay document or write. 45 00:04:22,650 --> 00:04:26,910 Should really be used in production right. 46 00:04:26,920 --> 00:04:29,550 So what did document right method. 47 00:04:29,550 --> 00:04:34,770 Does it all just write a line on it. 48 00:04:34,830 --> 00:04:36,980 What is bisley use to write a text. 49 00:04:37,140 --> 00:04:39,600 So what people do is to write this text. 50 00:04:39,630 --> 00:04:43,210 Good morning plus whatever name is entered the name. 51 00:04:43,230 --> 00:04:45,330 Here is a name we're talking about here. 52 00:04:45,330 --> 00:04:53,300 If my name is Joe Bloggs say good morning Joe Bloggs plots in I will give dinners I mention Mark. 53 00:04:53,610 --> 00:04:59,640 Okay so what is code is same on line 6. 54 00:04:59,640 --> 00:04:59,950 Hmm. 55 00:05:00,380 --> 00:05:07,860 If statement it's saying that if the hours notice we've got a variable called hours on line 3 if the 56 00:05:07,920 --> 00:05:15,570 hours is less down or equals to 12 then write this statement on the screen. 57 00:05:15,570 --> 00:05:16,740 Good morning. 58 00:05:16,740 --> 00:05:22,320 Plus the name of the person the name the person entered in line one. 59 00:05:22,850 --> 00:05:24,180 Okay you say good morning. 60 00:05:25,080 --> 00:05:35,360 Plus that plus the explanation or else the hours is less than or equal to 18 hours. 61 00:05:35,560 --> 00:05:39,730 Then write this statement document right. 62 00:05:39,750 --> 00:05:41,150 Good afternoon. 63 00:05:41,160 --> 00:05:44,260 Plus the name of the person in this claymation. 64 00:05:44,280 --> 00:05:45,160 All right. 65 00:05:45,660 --> 00:05:48,570 Else you write document. 66 00:05:48,810 --> 00:05:50,210 All right. 67 00:05:50,280 --> 00:05:51,060 Good evening. 68 00:05:51,060 --> 00:05:56,330 Plus the name of the person and then document or writing you create. 69 00:05:56,330 --> 00:05:57,260 That means you create it. 70 00:05:57,270 --> 00:05:58,400 Break the document. 71 00:05:58,390 --> 00:05:58,880 All right. 72 00:05:58,900 --> 00:06:02,860 I mean he has an extra line underneath it. 73 00:06:03,000 --> 00:06:10,910 All right so in a nutshell the statement is used to check the conditions the hours is less some equal 74 00:06:10,920 --> 00:06:11,490 say 12. 75 00:06:11,520 --> 00:06:13,900 It would display a message saying good morning. 76 00:06:14,070 --> 00:06:20,940 Plus the name of the person that's a name that was entered in line one if the hours is less than year 77 00:06:20,980 --> 00:06:21,960 close to 18. 78 00:06:21,960 --> 00:06:27,420 It'll display Good afternoon to name or else it'll display. 79 00:06:27,450 --> 00:06:28,200 Good evening. 80 00:06:28,200 --> 00:06:29,690 Plus to name. 81 00:06:29,760 --> 00:06:30,290 All right. 82 00:06:30,300 --> 00:06:36,250 So d document or write line undocument or write are similar documents. 83 00:06:36,240 --> 00:06:36,730 All right. 84 00:06:36,780 --> 00:06:42,120 Basically is used to write text on the screen while the document done right. 85 00:06:42,170 --> 00:06:50,830 It's the same but the difference is that it adds a new line character after each statement. 86 00:06:50,910 --> 00:06:56,940 Please do not use the document right or rifling in the production environment. 87 00:06:57,210 --> 00:07:04,650 This is only for testing because if you use this once you're hastier mila's it will delete all your 88 00:07:04,650 --> 00:07:05,930 hasty email. 89 00:07:06,030 --> 00:07:07,070 Very important. 90 00:07:07,090 --> 00:07:10,000 Only used is for testing only. 91 00:07:10,410 --> 00:07:11,470 So that's it. 92 00:07:11,470 --> 00:07:15,430 So let me say this and then we can test. 93 00:07:16,380 --> 00:07:18,500 All right so this is hard direct crime. 94 00:07:18,510 --> 00:07:21,820 I just need to click on that. 95 00:07:21,920 --> 00:07:24,400 We should have a prompt So this is the prompt. 96 00:07:24,630 --> 00:07:32,860 So I just need to change that variable and tie I'm just so you don't move for example and call. 97 00:07:32,880 --> 00:07:34,000 Okay. 98 00:07:34,380 --> 00:07:35,030 And you should see. 99 00:07:35,040 --> 00:07:41,860 Good evening you dimi it detected from my clock on my computer that isn't even in here. 100 00:07:42,040 --> 00:07:42,880 That's it. 101 00:07:42,990 --> 00:07:43,930 That's obvious. 102 00:07:44,060 --> 00:07:50,580 It detects the time from your computer and displays a message based on the negative For example if you 103 00:07:50,580 --> 00:07:52,050 type team. 104 00:07:52,270 --> 00:07:53,900 Then what are you typed in Peter. 105 00:07:53,970 --> 00:07:54,460 We'll see. 106 00:07:54,480 --> 00:07:56,100 Good evening Peter. 107 00:07:56,100 --> 00:07:59,280 Depending on the time where you are. 108 00:07:59,280 --> 00:08:00,210 So that's it. 109 00:08:00,210 --> 00:08:01,460 Thanks for watching. 110 00:08:01,470 --> 00:08:02,810 Bye for now.